<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/operateTag" prefix="o"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>会员消费查询</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<jsp:include page="/page/head.jsp"></jsp:include>
	<script type="text/javascript">
	
		$(document).ready(function(){
		
		    $('#mgrTable').datagrid({
       			height: 450, 
		        pageSize: 20,//每页显示的记录条数，默认为10  
		        pageList: [10,15,20],//可以设置每页记录条数的列表
				nowrap: true,
        		border: true,  
				striped: true,
				collapsible: false,
				url:path+'/consumerInfo/list.do',
				sortName: 'id',
				sortOrder: 'asc',
				remoteSort: false,
				idField:'id',
				pagination:true,
				rownumbers:true,
				toolbar:'#toolbar'
			});
		    
		    
		    
			var p = $('#mgrTable').datagrid('getPager');
			$(p).pagination({   
		        beforePageText: '第',//页数文本框前显示的汉字  
		        afterPageText: '页    共  {pages} 页',  
		        displayMsg: '当前显示  {from} - {to} 条记录   共  {total} 条记录'
		    });
			
		});
		
		function add(){
			window.location = path+"/consumerInfo/init.do?type=add";
		}
		
		function refresh(){
			$('#mgrTable').datagrid('reload');
			$('#mgrTable').datagrid('clearSelections');
		}
		
		function search(){
			var consumerTimeStart = $('#consumerTimeStart').datebox('getValue');
			var consumerTimeEnd = $('#consumerTimeEnd').datebox('getValue');
			var userMobile = $('#userMobile').val();
			var userCardId = $('#userCardId').val();
			var consumerInfoType = $('#consumerInfoType').val();
			var orgName = $('#orgName').val();
			var amountBegin = $('#amountBegin').val();
			var amountEnd = $('#amountEnd').val();
			$('#mgrTable').datagrid('reload',{consumerTimeStart:consumerTimeStart,consumerTimeEnd:consumerTimeEnd,userMobile:userMobile,
				userCardId:userCardId,consumerInfoType:consumerInfoType,orgName:orgName,amountBegin:amountBegin,amountEnd:amountEnd});
		}
		
		function clean(){
			$('#consumerTimeStart').datebox('setValue','');
			$('#consumerTimeEnd').datebox('setValue','');
			$('#userMobile').attr('value','');
			$('#userCardId').attr('value','');
			$('#consumerInfoType').attr('value','');
			$('#orgName').attr('value','');
			$('#amountBegin').attr('value','');
			$('#amountBegin').numberbox('fix');//把值固定为有效的值
			$('#amountEnd').attr('value','');
			$('#amountEnd').numberbox('fix');//把值固定为有效的值
		}
	</script>

  </head>
  
  <body>
    <div class="right">
		<h1><b>会员消费查询</b><span><img src="<%=basePath %>images/right_h1bg2.jpg" width="3" height="29" /></span></h1>
		<div class="ri_main">
			<table width="97%" border="0" cellspacing="0" cellpadding="4">
			  <tr>
			    <td style="vertical-align: middle;">
			    	<label>消费时间：</label>
			    	<input id="consumerTimeStart" class="easyui-datebox" editable="false"></input>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<label>到：</label>
			    	<input id="consumerTimeEnd" class="easyui-datebox" editable="false"></input>
			    	&nbsp;&nbsp;
			    	<select id="consumerInfoType" name="consumerInfoType">
			    		<option value="">请选择类型</option>
						<c:forEach var="dict" items="${consumerInfoType}">
				   			<option value="${dict.code}">${dict.name}</option>
				   		</c:forEach>
					</select>
			    </td>
			  </tr>
			  <tr>
			    <td style="vertical-align: left;">
			    	<label>会员手机：</label>
					<input id="userMobile" class="easyui-validatebox"></input>
					&nbsp;&nbsp;
			    	<label>卡号：</label>
			    	<input id="userCardId" class="easyui-validatebox"></input>
			    	&nbsp;&nbsp;
			    	<label>商家名称：</label>
			    	<input id="orgName" class="easyui-validatebox"></input>
			    </td>
			  </tr>
			  <tr>
			    <td style="vertical-align: left;">
			    	<label>消费金额：</label>
					<input id="amountBegin" class="easyui-numberbox"></input>
					&nbsp;&nbsp;&nbsp;&nbsp;
			    	<label>到：</label>
			    	<input id="amountEnd" class="easyui-numberbox"></input>
			    	&nbsp;&nbsp;
			    	<input type="button" onclick="search()" value="查询" />
			    	<input type="button" onclick="clean()" value="清空" />
			    </td>
			  </tr>
			</table>
			<div id="toolbar">
				<a href="javascript:void(0);" onclick="add()" class="easyui-linkbutton" iconCls="icon-add">添加</a>
				<a href="javascript:void(0);" onclick="refresh()" class="easyui-linkbutton" iconCls="icon-reload">刷新</a>
			</div>
		 	<table id="mgrTable">
		 		<thead>
		 			<tr height="20">
						<th field="trueName" width="120">会员名称</th>
		 				<th field="userCardId" width="120">会员卡号</th>
						<th field="amount" width="70">消费金额</th>
						<th field="score" width="70">兑换积分</th>
						<th field="consumerTime" width="150">消费时间</th>
						<th field="orgName" width="150">消费商家</th>
		 			</tr>
		 		</thead>
		 	</table>  
		</div>
	</div>
  </body>
</html>